const authController = require('../controllers/authController');
const authMiddleware = require('../middlewares/authMiddleware');
const Router = require('koa-router');

// 添加/api前缀
const router = new Router({ prefix: '/api' });

// 不需要认证的路由
router.post('/register', authController.register);
router.post('/login', authController.login);
router.get('/verify-token', authController.verifyToken);

// 需要认证的路由
router.get('/current-user', authMiddleware, authController.getCurrentUser);
router.put('/update-user', authMiddleware, authController.updateUser);
router.put('/change-password', authMiddleware, authController.changePassword);

module.exports = router;